package com.itheima.controller;

import com.itheima.service.SmsCouponHistoryService;
import com.itheima.vo.PageResultVo;
import com.itheima.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/couponHistory")
public class SmsCouponHistoryController {
    @Autowired
    private SmsCouponHistoryService service;

    //根据根据优惠券id，使用状态，订单编号分页获取领取记录
    @GetMapping("/list")
    public ResponseEntity list(Integer couponId, Integer pageNum, Integer pageSize,
                               Integer useStatus, String orderSn) {
        PageResultVo vo = service.queryCouponList(couponId, pageNum, pageSize, useStatus, orderSn);
        return ResponseEntity.ok(Result.success(vo));
    }
}
